using System;

namespace SJBotGame
{
	public class Point
	{
		private int x;
		public int X { get { return x; } set { x = value; } }
		//
		private int y;
		public int Y { get { return y; } set { y = value; } }
		//
		public Point(int x, int y)
		{
			this.x = x;
			this.y = y;
		}
        //
        public override string ToString ()
        {
            return string.Format("[Point: X={0}, Y={1}]", X, Y);
        }
        public override int GetHashCode()
        {
            return (this.X.GetHashCode() + this.Y.GetHashCode());
        }
        public override bool Equals(object obj)
        {
            Point point = (Point) obj;
            return ((this.X == point.X) && (this.Y == point.Y));
        }
        //
        public bool IsNear(Point point)
        {
            int len = Math.Abs(point.X - this.X) + Math.Abs(point.Y - this.Y);
            return (len == 1);
        }
	}
}

